package com.ykt.mall.ctrl;

import org.apache.log4j.Logger;

import com.jfinal.aop.Before;
import com.jfinal.aop.ClearInterceptor;
import com.jfinal.aop.ClearLayer;
import com.jfinal.core.ActionKey;
import com.jfinal.core.Controller;
import com.jfinal.ext.route.ControllerBind;
import com.ykt.mall.content.Content;
import com.ykt.model.Product;
import com.ykt.model.Shop;

@ControllerBind(controllerKey="/productDetail",viewPath="/product")//viewPath="/template"
public class productDetailCtrl  extends Controller {
	private static Logger log = Logger.getLogger(productDetailCtrl.class);
	
	public void productDetial() {
		int productId = getParaToInt(0);
		Product product = Product.dao.findById(productId);//取得商品
		Shop shop = Shop.dao.findById(product.getInt("shop_id"));//取得商家
		
		System.out.println(product.getInt("shop_id") + "===============" + product);
		
		setAttr("productDetail", product);
		setAttr("shop", shop);
		render("/template/product/index.html");
		
	}
	
	public void aa(){
		System.out.println("---------------");
	}
	
}
